/*
 * @Author       : NaN 353362604@qq.com
 * @Date         : 2023-01-12 09:35:49
 * @LastEditTime : 2023-06-07 14:19:36
 * @LastEditors  : NaN 353362604@qq.com
 * @FilePath     : \AdminStration\src\Common\Modal\TwoModalList\PersonGroup.jsx
 * @Description  :
 */
import { API_LIST } from '../../Api/Api'
import { TwoAddBtn, ThrDeleteBtn } from '../options'

export const PersonGroup = async ({ data, upDataEvent, Permission }) => {
    console.log(Permission)
    let dataList = {
        type: '人员分组明细',
        hideInSearch: true,
        pageSize: 10,
        params: { personGroupUuid: data.uuid },
        classification: 'TableModal',
        get: API_LIST()['getPersonGroupDetail'],
        options: [
            Permission.findIndex(v => v.uuid === '78683476-4565-4906-a9de-8c2a17d78e51') !== -1 && (
                <TwoAddBtn
                    upDataEvent={upDataEvent}
                    title="添加人员"
                    ThrKey="ThrModal"
                    value="PersonGroup"
                    data={data}
                />
            ),
        ],
        columns: [
            {
                dataIndex: 'tableName',
                title: '人员姓名',
                valueType: 'input',
            },
            {
                dataIndex: 'personTypeName',
                title: '人员类别',
                valueType: 'input',
            },
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 300,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    const { uuid } = record
                    return [
                        Permission.findIndex(v => v.uuid === 'd46a8ee4-4555-40eb-b0f6-ead0b8096c95') !== -1 && (
                            <ThrDeleteBtn
                                key="delete"
                                additional={[uuid]}
                                record={uuid}
                                upDataEvent={upDataEvent}
                                data={{ key: 'delete', url: 'delPersonGroupDetail', title: '删除' }}
                            />
                        ),
                    ]
                },
            },
        ],
    }
    return dataList
}
